#!/bin/sh
data=$(/usr/bin/top -bi -n 1 | head -n 3| tail -n 1)
sys=$(echo $data|awk -F '[ %]+' '{print $4}')
us=$(echo $data|awk -F '[ %]+' '{print $2}')
ni=$(echo $data|awk -F '[ %]+' '{print $6}')
id=$(echo $data|awk -F '[ %]+' '{print $8}')
wa=$(echo $data|awk -F '[ %]+' '{print $10}')
echo "{\"system\":$sys,\"user\":$us,\"nice\":$ni,\"idle\":$id,\"wait\":$wa}"
